<?php

namespace app\service;


use app\tool\SingletonTrait;

class WorkHourService
{
    use SingletonTrait;

    public function __construct()
    {
    }

    /**
     * 查询用户上班打卡工时
     * @param array $userIdList
     * @param int $startDate
     * @param int $endDate
     * @return array
     */
    public function queryUserWorkHour(array $userIdList, string $startDate, string $endDate)
    {
        $req = [
            'user_id_list' => $userIdList,
            'work_date_from' => $startDate,
            'work_date_to' => $endDate,
        ];

        $res = teamones_request('teamones-work-hour', 'dingtalk/get_user_work_times', $req);
        return array_column($res['data'], 'work_hour', 'user_id');
    }
}